<?php
  function act_form_validation($form, &$form_state) {

   /*District Validation*/
  distvalidation($form['field_act_concerned_district']['und']['#value']);
   //print_r($dist_value);

   /*Act Title validaation*/
  minilength_validation($form['field_act_title']['und'][0]['value']['#value'], 5, $form['field_act_title']['und'][0]['value']['#title'], 'field_act_title');
  chkbadchar($form['field_act_title']['und'][0]['value']['#value'],$form['field_act_title']['und'][0]['value']['#title'],'field_act_title');

  /*ACT Number*/
  check_integer($form['field_act_number']['und'][0]['value']['#value'],$form['field_act_number']['und'][0]['value']['#title'],'field_act_number');
  chkbadchar($form['field_act_number']['und'][0]['value']['#value'],$form['field_act_number']['und'][0]['value']['#title'],'field_act_number');


  // Act Year
  check_integer($form['field_act_year']['und'][0]['value']['#value'],$form['field_act_year']['und'][0]['value']['#title'],'field_act_year');
  years($form['field_act_year']['und'][0]['value']['#value'],$form['field_act_year']['und'][0]['value']['#title'],'field_act_year');

  /*Short Title*/
  maxlength_validation($form['title']['#value'], 255, $form['title']['#title'], 'title');
  minilength_validation($form['title']['#value'], 5, $form['title']['#title'], 'title');
  chkbadchar($form['title']['#value'], $form['title']['#title'], 'title');

  // Commencement date
  Commencement_date($form['field_act_comm_date']['und'][0]['value']['date']['#value'], 'Act Objectives','field_act_comm_date');

  // Act Objectives
  chkbadchar($form['field_act_objectives']['und'][0]['value']['#value'], $form['field_act_objectives']['und'][0]['value']['#title'], 'field_act_objectives');

  //Availability act details validation
  if ($form['field_act_details']['und']['#value'] == 'online') {
    url_validation($form['field_act_url']['und'][0]['value']['#value']);
  }


	//minimum length charcter

  	minilength_validation($form['field_act_keyword']['und'][0]['value']['#value'], 5, $form['field_act_keyword']['und'][0]['value']['#title'],'field_act_keyword');
    chkbadchar($form['field_act_keyword']['und'][0]['value'] ['#value'], $form['field_act_keyword']['und'][0]['value'] ['#title'], 'field_act_keyword');

  if ($form['field_act_details']['und']['#value'] == 'download') {
	$filename = $form['field_act_file_upload']['und'][0]['#file'];
	$filename->filename;
    file_upload_validation_D7($filename->filename,$form['field_act_details']['und']['#title']);
    //chkbadchar($form['field_act_url']['und'][0]['value']['#value'], $form['field_act_url']['und'][0]['value']['#title'], 'field_act_url');
  }
  }

  function act_presave_validaiton($node) {
    $reference_url = $node->field_act_url['und'][0]['value'];
    $node->field_act_url['und'][0]['value'] = url_validation($reference_url);
  } // function act_presave_validaiton()


